# -*- codeing = utf-8 -*-
# @Time : 2021/1/1 16:45
# File : jiqiren.py

import requests

#生成Session对象，用于保存Cookie
s = requests.Session()

#登录豆瓣
login_url  = "https://accounts.douban.com/j/mobile/login/basic"
#请求头
headers = {'User-Agent':'Mozilla/5.0', 'Referer':'https://accounts.douban.com/passport/login_popup?login_source=anony'}
#传递用户名和密码
data = {
    'name':'13570716079',
    'password': 'lan7712213',
    'remember':'true'
}
try:
    r = s.post(login_url, headers=headers, data=data)
    r.raise_for_status()
except:
    print('爬取失败')

#打印请求结果
print(r.text)